import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { RouteComponent } from './pages/route/route.component';
import { VehicleComponent } from './pages/vehicle/vehicle.component';
import { SetComponent } from './pages/set/set.component';
import { TransportComponent } from './pages/transport/transport.component';
import { DeliverComponent } from './pages/deliver/deliver.component';
import { RouteDetailComponent } from './pages/route-detail/route-detail.component';
import { VehicleDetailComponent } from './pages/vehicle-detail/vehicle-detail.component';
import { TransportDetailComponent } from './pages/transport-detail/transport-detail.component';
import { DeliverDetailComponent } from './pages/deliver-detail/deliver-detail.component';

const routes: Routes = [
    {
        path: 'set', component: SetComponent, data: {
            breadcrumbs: [{ title: '配送主页' }]
        },
    },
    {
        path: 'route', component: RouteComponent, data: {
            breadcrumbs: [{ title: '路线设置', path: '/logistics/route' }]
        },
        children: [
            {
                path: 'detail', component: RouteDetailComponent, data: {
                    breadcrumbs: [{ title: '路线设置', path: '/logistics/route' }, { title: '新增' }]
                }
            },
        ]
    },
    {
        path: 'vehicle', component: VehicleComponent, data: {
            breadcrumbs: [{ title: '车辆管理', path: '/logistics/vehicle' }]
        },
        children: [
            {
                path: 'detail', component: VehicleDetailComponent, data: {
                    breadcrumbs: [{ title: '车辆管理', path: '/logistics/vehicle' }, { title: '新增' }]
                }
            },
            {
                path: 'detail/:id',
                component: VehicleDetailComponent,
                data: { breadcrumbs: [{ title: '车辆管理', path: '/logistics/vehicle' }, { title: '商品详情' }] }
            },
        ]
    },
    {
        path: 'transport', component: TransportComponent, data: {
            breadcrumbs: [{ title: '运输单', path: '/logistics/transport' }]
        },
        children: [
            {
                path: 'detail', component: TransportDetailComponent, data: {
                    breadcrumbs: [{ title: '运输单', path: '/logistics/transport' }, { title: '新增运输单' }]
                }
            },
        ]
    },
    {
        path: 'deliver', component: DeliverComponent, data: {
            breadcrumbs: [{ title: '发货监控', path: '/logistics/deliver' }]
        },
        children: [
            {
                path: 'detail', component: DeliverDetailComponent, data: {
                    breadcrumbs: [{ title: '发货监控', path: '/logistics/deliver' }, { title: '新增发货监控' }]
                }
            },
        ]
    },
];

export const declarationComponents = [
    RouteComponent,
    VehicleComponent,
    SetComponent,
    TransportComponent,
    DeliverComponent,
    RouteDetailComponent,
    VehicleDetailComponent,
    TransportDetailComponent,
    DeliverDetailComponent,
];

export const entryComponents = [
    RouteComponent,
    VehicleComponent,
    SetComponent,
    TransportComponent,
    DeliverComponent,
    RouteDetailComponent,
    VehicleDetailComponent,
    TransportDetailComponent,
    DeliverDetailComponent,
];

@NgModule({
    imports: [
        RouterModule.forChild(routes)
    ],
    exports: [
        RouterModule
    ]
})
export class LogisticsRoutingModule { }
